#include<iostream>
#include<cstring>
using namespace std;
class Person{
private:
    char* name;
public:
    Person(const char* n){
        name=new char[strlen(n)+1];
        strcpy(name,n);
    }
    ~Person(){
        delete[] name;
    }
    void setName(const char* n){
        delete[] name;
        name=new char[strlen(n)+1];
        strcpy(name,n);
    }
    const char* getName(){
        return name;
    }
};
int main(){
    Person p("alice");
    cout<<p.getName()<<endl;
    p.setName("Bob");
    cout<<"name:"<<p.getName()<<endl;

    return 0;
}